<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:o="http://omnifaces.org/ui"
      xmlns:p="http://primefaces.org/ui">
    <h:body>
        <ui:composition>
            <o:importConstants type="com.satish.gmailapp.constants.WebConstants" />
            <h:form>
                <p:messages id="messages" autoUpdate="true" closable="true" severity="info"/>

                <p:panel id="trashPanel" header="#{msg.TrashMessages}" >
                    <h:panelGrid columns="3" cellpadding="10">
                        <h:outputText value="#{msg.From}"/>
                        <p:inputText id="fromEmail" value="#{gmail.criteria.from}" validatorMessage="#{msg.InvalidEmail}"
                                     required="true" requiredMessage="#{msg.FromEmailRequired}">
                            <f:validateRegex
                                pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
                        </p:inputText>
                        <p:message for="fromEmail" />
                        
                        <p:commandLink id="ajax" class="btn btn-large btn-success" 
                            update="messages,trashPanel" actionListener="#{gmail.trashMessages}" style="margin-top: 1em;">
                            <h:outputText value="#{msg.Go}" />
                        </p:commandLink>
                    </h:panelGrid>
                </p:panel>                
                <p:blockUI id="blockUI" block="trashPanel" trigger="ajax">
                    <h:outputText value="#{msg.Processing}"/><br />
                </p:blockUI>
            </h:form>
        </ui:composition>
    </h:body>
</html>